﻿using System;

namespace Mojo.Menus
{
    public class MenuItem
    {
        /// <summary>
        /// Optional. User visible label for this item, not rendered for groups.
        /// </summary>
        public string Label;

        /// <summary>
        /// Optional. CSS class for icon to display in this item.
        /// </summary>
        public string Icon;

        /// <summary>
        /// Optional. Path to image to display in menu item, relative to app's directory.
        /// </summary>
        public string IconPath;

        /// <summary>
        /// Optional. Calculated based on item's width - specifies the width in pixels of this menu item. Overrides default calculations. Ignored for groups.
        /// </summary>
        public int Width;

        /// <summary>
        /// Optional. If specified, this item is a "group" that visually ties the child items together.
        /// </summary>
        public object[] Items;


        /// <summary>
        /// Optional. Only used when "items" is specified. Specify this property to make this group a "toggle group". This string is the command of the currently selected "choice" item in this group, and this property is modified by the widget when a different choice is made.
        /// </summary>
        public string ToggleCmd;

        /// <summary>
        /// Optional. Specify to make this item a "choice". It will then respond to a user tap by sending a mojo-command event through the commander chain with this string as the command property.
        /// </summary>
        public string Command;

        /// <summary>
        /// Optional. Menu choice is disabled when this is true. Only used for items which also specify command.
        /// </summary>
        public bool Disabled;

        /// <summary>
        /// Optional. Specify to make this item a submenu item. It will then respond to a user tap by displaying the named menu as a popup submenu.
        /// </summary>
        public string Submenu;

        /// <summary>
        /// Optional. Path to HTML template for custom content to be inserted instead of a standard menu item. The template is rendered using this item model object for property substitution.
        /// </summary>
        public string Template;

        /// <summary>
        /// Optional. If truthy, a Mojo.Event.commandEnable event will be sent through the commander chain each time this menu item is displayed or invoked via keyboard shortcut. If a commander calls preventDefault() on the event, then the menu item's model will be modified to disable the menu item. Otherwise it will be enabled. This can be used to lazily update the enable state of items in the app-menu or submenus.
        /// </summary>
        public bool CheckEnabled;
    }
}
